import React, { Component } from "react";

import { withRouter } from "../routes/withRouter";

class Header extends Component {
  back() {
    const { router } = this.props;
    router.navigate(-1);
  }

  forward() {
    const { router } = this.props;
    router.navigate(1);
  }

  render() {
    return (
      <div>
        <div>Hello, React!</div>
        <div>
          <button type="button" onClick={this.back.bind(this)}>
            Back
          </button>
          <button type="button" onClick={this.forward.bind(this)}>
            Forward
          </button>
        </div>
      </div>
    );
  }
}

export default withRouter(Header);
